package com.hwqsdk.myapplication;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.util.Log;
import android.widget.Toast;

/**
 * Create by Fanketly on 2022/5/5
 * Gitee:https://gitee.com/fanketly
 * desc:
 */
public class GB extends BroadcastReceiver {
    public final static String TAG = "test";
    @Override
    public void onReceive(Context context, Intent intent) {
        Log.i("TAG", "onReceive: ");
        Toast.makeText(context, "666", Toast.LENGTH_SHORT).show();
//        ConnectivityManager connectionManager = (ConnectivityManager)
//                context.getSystemService(Context.CONNECTIVITY_SERVICE);
//        NetworkInfo networkInfo = connectionManager.getActiveNetworkInfo();
//
//        if (networkInfo != null && networkInfo.isAvailable()) {
//
//            //有网
//            Toast.makeText(context, "network is available", Toast.LENGTH_SHORT).show();
//
//        } else {
//
//            //无网
//            Toast.makeText(context, "network is unavailable",
//                    Toast.LENGTH_SHORT).show();
//        }
    }

}
